using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using PccCommonForC;
public partial class Pub_Module_Banner : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            clsWebShop cls = new clsWebShop();
            PccMsg msg = new PccMsg();
            msg.CreateFirstNode("ID", "");
            msg.CreateFirstNode("NavigateUrl", "");
            msg.CreateFirstNode("ShowMK", "Y");
            DataTable dt = cls.Get_BannerByCondition(msg.GetXmlStr.ToString()).Tables[0];
            if (dt.Rows.Count > 0)
            {
                /*if (dt.Rows[0]["ShowMK"].ToString() == "Y")
                {
                    imgBanner.ImageUrl = ResolveUrl("~/" + dt.Rows[0]["ImgUrl"].ToString());
                    imgBanner.PostBackUrl = dt.Rows[0]["NavigateUrl"].ToString();
                }
                else
                {
                    imgBanner.ImageUrl = ResolveUrl("~/Images/Body/hotpd.jpg");
                }*/

                if (dt.Rows[0]["BannerType"].ToString().ToUpper() == "IMG")
                {
                    HtmlAnchor embed = new HtmlAnchor();
                    embed.InnerHtml = " <a target='_blank' href='" + dt.Rows[0]["NavigateUrl"].ToString() + "'><img border='0' src='" + ResolveUrl("~/" + dt.Rows[0]["ImgUrl"].ToString()) +"' width='100%'></a>";
                    pnlBanner.Controls.Add(embed);
                }
                else if (dt.Rows[0]["BannerType"].ToString().ToUpper() == "SWF")
                {
                    HtmlAnchor embed = new HtmlAnchor();
                    embed.InnerHtml = "<a  target='_blank' href='" + dt.Rows[0]["NavigateUrl"].ToString() + "'><embed quality='high'   src='" + ResolveUrl("~/" + dt.Rows[0]["ImgUrl"].ToString()) + "'  loop='false' width='100%' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'> </embed> </a>";
                    pnlBanner.Controls.Add(embed);
                }
            }
           /* else
            {
                imgBanner.ImageUrl = ResolveUrl("~/Images/Body/hotpd.jpg");
            }*/
        }
    }
}
